<?php

namespace plugin\webman\gateway;

use GatewayWorker\Lib\Gateway;

class EventsTcp
{
    public static function onWorkerStart($worker)
    {

    }

    public static function onConnect($client_id)
    {
        // echo $client_id;
        // Gateway::bindUid($client_id,1);
    }

    public static function onWebSocketConnect($client_id, $data)
    {

    }

    public static function onMessage($client_id, $message)
    {
        // echo $message;
        Gateway::sendToClient($client_id, $message);
        // Gateway::sendToUid(1,2);
    }

    public static function onClose($client_id)
    {

    }
    //发送
    public static function sendToUid($uid,$data){
        
        Gateway::sendToUid($uid,$data);
    }

}
